<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>44. 正则方法test</title>
</head>
<body>
    <input type="text" name="email">
</body>
<script>
    //邮箱验证
// match matchAll search replace  字符串对象的方法
let yx=document.querySelector(`[name="email"]`);
yx.addEventListener('keyup',(e)=>{
let value=e.target.value;
let flag= /^[\w-]+@(\w+\.)+(com|cn|cc)$/i.test(value)
console.log(flag);
})
</script>

</html>